from common.base import Base,By,open_browser,sleep
import random
sj_account='buyer2407'+str(random.randint(000000,999999))
class BuyerRegPage(Base):
    _username_loc=(By.NAME,'username')#用户名输入框
    _password_loc=(By.NAME,'password')#密码输入框
    _repassword_loc=(By.NAME,'repassword')#重复密码输入框
    _captcha_loc=(By.NAME,'captcha')#验证码输入框
    _submit_reg_loc=(By.NAME,'submit_reg')#注册按钮
    _reg_status_loc=(By.CLASS_NAME,'f14')#注册成功，提示词元素
    def input_username(self,username):
        self.send_keys(BuyerRegPage._username_loc,username)

    def input_password(self, password):
        self.send_keys(BuyerRegPage._password_loc, password)
    def input_repassword(self,repassword):
        self.send_keys(BuyerRegPage._repassword_loc,repassword)
    def input_captcha(self,captcha):
        self.send_keys(BuyerRegPage._captcha_loc,captcha)
    def click_reg(self):
        self.click(BuyerRegPage._submit_reg_loc)
    def is_success_reg(self,txt):
        text=self.get_element_text(BuyerRegPage._reg_status_loc)
        if txt==text:
            return True
        else:
            return False